📘 API Documentation: List Metrics
Base URL
https://property.ysgcloud.com.ng
Endpoint
/api/metrics
Authentication
No authentication required. If added later, use Authorization: Bearer <token>.
Request
- Method: GET
- Headers:
Accept: application/json
Response
Returns a metrics object with the following fields:
- NoofProperties
- NoofUnits
- NoofTenants
- NoofLandlords
- VacantUnits
- OccupiedUnits
- ActiveRents
- ExpiredRents
- PortfolioTotal
Example Success Response
{
"NoofProperties": 12,
"NoofUnits": 48,
"NoofTenants": 35,
"NoofLandlords": 10,
"VacantUnits": 13,
"OccupiedUnits": 35,
"ActiveRents": 30,
"ExpiredRents": 5,
"PortfolioTotal": 12500000
}
Error Response
{
"status": "error",
"message": "Invalid request or server error"
}
Example Usage
JavaScript (Browser)
<script>
fetch("https://property.ysgcloud.com.ng/api/metrics")
.then(response => {
if (!response.ok) throw new Error("Network error");
return response.json();
})
.then(metrics => {
console.log("Retrieved metrics:", metrics);
console.log(
`Properties: ${metrics.NoofProperties}, Units: ${metrics.NoofUnits}, Tenants: ${metrics.NoofTenants},
Landlords: ${metrics.NoofLandlords}, Vacant: ${metrics.VacantUnits}, Occupied: ${metrics.OccupiedUnits},
Active Rents: ${metrics.ActiveRents}, Expired Rents: ${metrics.ExpiredRents}, Portfolio Total: ${metrics.PortfolioTotal}`
);
})
.catch(err => console.error("Error:", err));
</script>
Postman
GET Request
- Method: GET
- URL:
https://property.ysgcloud.com.ng/api/metrics - Headers:
Accept: application/json
Live Demo
Open your browser console to see the retrieved metrics data: